#include <cstdio>
#include <cstring>

using namespace std;

int main() {
  int i,j ,k;
  int array[5001];
  memset(array, 0, sizeof(array));
  for (int a = 0; a < 5 ; ++a) for (int b = 0; b < 10 ; ++b ) for (int c = 0; c < 10; ++c) for (int d = 0; d < 10 ; ++d ) {
    if (a) {
      if (a != b && a != c && a != d && b != c && b != d && c != d) array[a*1000+b*100+c*10+d] = 1;
    } else if (b) {
      if (b != c && b != d && c != d) array[b*100+c*10+d] = 1;
    } else if (c) {
      if (c != d) array[c*10+d] = 1;
    } else if (d) array[d] = 1;
  }
  for (i = 1 ; i < 5001; ++i) array[i] = array[i-1]+array[i];
  int N, M;
  while (scanf("%d %d", &N, &M) != EOF) {
    printf("%d\n", array[M] - array[N-1]);
  }return 0;
}
